/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import com.chlitina.store.common.persistence.BaseDao;
import com.chlitina.store.common.persistence.BaseDaoImpl;
import com.chlitina.store.modules.expert.entity.SolutionFaceCare;
import com.chlitina.store.modules.expert.entity.SolutionFaceCareLocationSeason;
import com.chlitina.store.modules.expert.entity.SolutionFaceProductMix;

/**
 * 方案护理关联DAO接口
 * @author liujiang
 * @version 2013-11-05
 */
public interface SolutionFaceCareDao extends SolutionFaceCareDaoCustom, CrudRepository<SolutionFaceCare, Long> {
	@Query("from SolutionFaceCare where SOLUTION_ID = ?1 AND CARE_ID = ?2")
	public SolutionFaceCare findByPKId(Long solutionId, Long careId);
	
	@Query("from SolutionFaceCare where SOLUTION_ID = ?1")
	public List<SolutionFaceCare> findBySolutionId(Long solutionId);
	
	@Query("select distinct c from SolutionFaceCare c, CareStoreType t, SolutionFaceCareLocationSeason l "
			+ " where c.care.id = t.care.id and c.care.id = l.care.id and c.care.status = 0 "
			+ " and c.solutionFace.id = ?1 and l.solutionFace.id = ?1 and l.systemDefinitionAreaSeason.id = ?2 and t.storeType.id = ?3")
	public List<SolutionFaceCare> getBySolutionFace(long SolutionFaceId, long locationSeason, long storeTypeId);
}

/**
 * DAO自定义接口
 * @author liujiang
 */
interface SolutionFaceCareDaoCustom extends BaseDao<SolutionFaceCare> {

}

/**
 * DAO自定义接口实现
 * @author liujiang
 */
@Component
class SolutionFaceCareDaoImpl extends BaseDaoImpl<SolutionFaceCare> implements SolutionFaceCareDaoCustom {

}
